package core.object
{
	import flash.display.BitmapData;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class SpriteSheet
	{
		public function SpriteSheet()
		{
		}
		
		public var column:int;
		
		public var row:int;
		
		public var width:Number = 0;
		
		public var height:Number = 0;
		
		private var _maxFrame:int;
		
		public function get maxFrame():int {
			return this._maxFrame;
		}
		
		private var _list:Array = [];
		
		public var id:int;
		
		public function parse(value:BitmapData):void {
			this._maxFrame = row * column - 1;
			if(this._maxFrame == -1){
				this._list.push(value);
				this._maxFrame = 1;
			}else {
				value.lock();
				for(var i:int = 0; i < row; i++){
					for(var j:int = 0; j < column; j++){
						var bitmapData:BitmapData = new BitmapData(width,height,true,0x00);
						bitmapData.copyPixels(value,new Rectangle(j * width, i * height,width,height),new Point(0,0));
						
						this._list.push(bitmapData);
					}
				}
				value.unlock();
				value.dispose();
				value = null;
			}
		}
		
		public function get list():Array {
			return this._list;
		}
		
		public var data:Object;// 里面可能一些需要处理的数据
	}
}